﻿#region

using Vin.Tool.Enums;

#endregion

namespace Vin.Tool.Attributes;

// [AttributeUsage(AttributeTargets.Class)]
public class ServiceAttribute : Attribute
{
    /// <summary>
    /// 生命周期
    /// </summary>
    public Lifetime Lifetime { get; set; } = Lifetime.Scoped;

    /// <summary>
    /// 服务实现的接口
    /// </summary>
    public Type? InterfaceType { get; set; }

    /// <summary>
    /// 服务实现的多个接口
    /// </summary>
    public Type[] InterfaceTypes { get; set; } = Array.Empty<Type>();

    /// <summary>
    /// 服务的Key
    /// </summary>
    public string? Key { get; set; }

    /// <summary>
    /// 服务的顺序
    /// </summary>
    public long Order { get; set; } = 0;

    public ServiceAttribute()
    {
    }

    public ServiceAttribute(string? key)
    {
        this.Key = key;
    }
}